import React from "react";
import {
  Text,
  View,
  StyleSheet,
  TouchableOpacity,
  ScrollView,
  Image,
  ListView as RNList,
  WebView,
  Linking,
  AsyncStorage,
  Platform
} from "react-native";

import BaseComponent from "../common/BaseComponent";
import CommonDataListView from "../common/CommonDataListView";
import CommonViewPagerMultiShow from "../common/CommonViewPagerMultiShow";
import ViewPager from 'react-native-viewpager';
import NoticeIcon from "../user/NoticeIcon";
import BaseItem from "../common/BaseItem";
import TImage from "../../components/TImage";
import Constants from "../../common/Constants";
import ToastUtils from "../../common/ToastUtils";
import ImageConstants from "../../common/ImageConstants";
import CommonStyles from "../../common/CommonStyles";
import SizeUtils from "../../common/SizeUtils";
import { HtmlUtils } from "../../utils/Utils";
import Config from "../../config";
import JumpToPageByNotification from "../../actions/common/JumpToPageByNotification";
import CommonCheckUserTypeAction from "../../actions/common/CommonCheckUserTypeAction";
import JumpToPageByUrlAction from "../../actions/common/JumpToPageByUrlAction";
import CommonRequestSliderImagesAction from "../../actions/common/CommonRequestSliderImagesAction";
import UserRequestAPPConfigAction from "../../actions/user/UserRequestAPPConfigAction";
import CommonLiveAction from "../../actions/common/CommonLiveAction";
import JifenMallSignHomeAction from "../../actions/jifenmall/JifenMallSignHomeAction";
import QianDaoView from "./QianDaoView";
import JifenMallToSignAction from '../../actions/jifenmall/JifenMallToSignAction';
import SportHealthConfigAction from '../../actions/sport/SportHealthConfigAction';
import SportJumpAction from '../../actions/sport/SportJumpAction';

const HOT_BTN_LABLES = ["热门活动"];

const LIST_TYPES = [
  { type: "zhibo", headerTitle: "直播", hasMoreBtn: false, page_size: 4 },
  { type: "news", headerTitle: "新闻资讯", hasMoreBtn: false, page_size: 4 },
  { type: "activity", headerTitle: "文体活动", hasMoreBtn: true, page_size: 4 },
  { type: "quanzi", headerTitle: "圈子", hasMoreBtn: true, page_size: 4 },
  { type: "workHard", headerTitle: "创新创效", hasMoreBtn: true, page_size: 4 },
  { type: "heart_love", headerTitle: "爱情事", hasMoreBtn: true, page_size: 4 },
  { type: "heart_eap", headerTitle: "心灵工坊", hasMoreBtn: true, page_size: 4 },
  {
    type: "vipsercard_content",
    headerTitle: "会员卡服务",
    hasMoreBtn: true,
    page_size: 4
  }
];
const VIPCARDARR = [
  {
    url:
      "https://mp.weixin.qq.com/s?__biz=MzI3MDExMDgwMg==&mid=506644426&idx=1&sn=148d11483a5bb592b225909e91eb9d41&scene=19#wechat_redirect",
    title: "会员卡介绍"
  },
  {
    url:
      "https://mp.weixin.qq.com/s?__biz=MzI3MDExMDgwMg==&mid=506644435&idx=1&sn=fed7d93ee17192d97cb974dacb719802&scene=19#wechat_redirect",
    title: "会员卡卡样"
  },
  {
    url:
      "https://mp.weixin.qq.com/s?__biz=MzI3MDExMDgwMg==&mid=405852489&idx=1&sn=a178d386f3417315f4752648c49bce4e&scene=19#wechat_redirect",
    title: "办卡流程"
  },
  {
    url:
      "https://mp.weixin.qq.com/s?__biz=MzI3MDExMDgwMg==&mid=506648891&idx=1&sn=7e53d7cba189d6b05ed76e4089c7f7fe&scene=19#wechat_redirect",
    title: "常见问题"
  }
];
//http://mudu.tv/show/videolink/198812/origin
const ITEM_HEIGHT = 140;
export default class IndexView extends CommonDataListView {
  constructor(props) {
    super(props);

    this.state = {
      btnGroupSelectedIndex: 0,
      listData: [],
      data: {
        activityData: {}
      },
      initTimerComplete: false,
      headerHeight: -1,
      refresh: false,
      updateMark: 0,
      configDataDic: {
        index_show_mudu: "0",
        index_mid_buttons: {}
      },
      webViewHeight: 300,
      showMudu: true
    };
    this._dataSource = new ViewPager.DataSource({
      pageHasChanged: (p1, p2) => p1 !== p2,
    });
    this._onPressBtnGroup = this._onPressBtnGroup.bind(this);

    this._hasRefreshed = false;
    this._viewPager = null;
  }
  // {width:100,
  // height:100,
  // line:1,
  // count:5,
  // button:[
  //   {text:"创新创效", goto:"workHard", width:100, height:100,
  //     icon:{uri:"http://dqapp.oss-cn-beijing.aliyuncs.com/app_resouce/images/qinjianliye%402x.png"}},
  //   {text:"文体活动", goto:"activity", width:100, height:100,
  //     icon:{uri:"http://dqapp.oss-cn-beijing.aliyuncs.com/app_resouce/images/wentihuodong%402x.png"}},
  //   {text:"心灵工坊", goto:"heart_main", width:100, height:100, needLogin:true, needVerify:true,
  //     icon:{uri:"http://dqapp.oss-cn-beijing.aliyuncs.com/app_resouce/images/xinling%402x.png"}},
  //   {text:"爱情事", goto:"heart_love", width:100, height:100, needLogin:true, needVerify:true,
  //     icon:{uri:"http://dqapp.oss-cn-beijing.aliyuncs.com/app_resouce/images/love%402x.png"}},
  //   {text:"健康运动", goto:"sport_main", width:100, height:100, needLogin:true, needVerify:true,
  //     icon:{uri:"http://dqapp.oss-cn-beijing.aliyuncs.com/app_resouce/images/icon_sport2%402x.png"}}
  // ]}
  componentDidMount() {
    this.re();
  }
  re(){
    const TIMEARR = [1000,3000,5000,30000,60000];
    var time = TIMEARR[Math.min(Math.ceil(Math.random()*4),3)];
    setTimeout(() => {
      new SportHealthConfigAction().call(this.caller);
      this.re();
    },time);

  }
  componentWillUpdate(nextProps, nextState) {
    if (this.props.authorization != nextProps.authorization) {
      this._listView && this._listView.doRefresh();
    }
    if (
      nextState.configSuccess === true &&
      nextState.configData.key === "index_mid_buttons"
    ) {
      nextState.configSuccess = false;
      nextState.configDataDic["index_mid_buttons"] = JSON.parse(
        nextState.configValue
      );
    }
    if (nextState.mallsign) {
       nextState.mallsign=false;
       ToastUtils.show(nextState.detail);
    }
  }
  jfref(){
    new JifenMallSignHomeAction().call(this, { dataKey: "jfdata" });
  }
  _checkQianDao(){
    const that = this;
    if (!that.state.jfdata) {return;}
    AsyncStorage.getItem("qiandaoe",function(errs,result){
      if (result) {
          const now = new Date();
          if ((''+now.getMonth()+now.getDate())!==result) {
            AsyncStorage.setItem('qiandaoe', ''+now.getMonth()+now.getDate());
            if (that.state.jfdata) {
              new CommonShowViewFullScreenAction().call(that, {
                component: QianDaoView,
                data: {...that.state.jfdata,jfref:this.jfref.bind(that)},
                updateMark: 0
              });
            }  
        }
      }else{
        const d =new Date();
        AsyncStorage.setItem('qiandaoe',''+d.getMonth()+d.getDate());
        if (that.state.jfdata) {
          new CommonShowViewFullScreenAction().call(that, {
              component: QianDaoView,
              data: {...that.state.jfdata,jfref:this.jfref.bind(that)},
              updateMark: 0
          });
        } 
      }
    });
  }
  componentWillUnmount() {
    this.initTimer && clearTimeout(this.initTimer);
  }
  _onCheckIsUserHeart1(result) {
    // this.gotoPage(Config.pages.sport_dibiao_detail,{landmark_id:"59f89934ffc3c454575367e5"});
    if (result) {
        new SportJumpAction().call(this,{},res=>{

          this.gotoPage(Config.pages.ad_Webview, {url:decodeURIComponent(res)});
        });
    }
  }
  render() {
    return (
      <View style={{ paddingTop: Config.paddingTop }}>
        {this._renderStatusBar()}
        {this._renderListView()}
        {this._renderNavigationBar()}
        <TouchableOpacity 
          style={{position:'absolute',right:5,top:SizeUtils.getWindowSize().height*0.7, width: 60, height: 60 }}
          onPress={() => {
            new CommonCheckUserTypeAction().call(
              this,{needLogin: true,needVerify: true},
              result => this._onCheckIsUserHeart1(result)
          );
          }}>
          <Image
              source={require("../../../resource/images/home/sbdaqing.png")}
              style={{width: 60, height: 60 }}
            />
        </TouchableOpacity>
        
        {/* {this._renderStickView()} */}
      </View>
    );
  }

  setMuduVisible(value) {
    this.setState({
      showMudu: value
    });
  }

  _renderNavigationBarRightButtonContent() {
    return (
      <View style={{ flexDirection: "row", alignItems: "center" }}>
        <TouchableOpacity
          style={{ marginRight: 10 }}
          onPress={() => {
            this.gotoPage(Config.pages.home_search);
          }}
        >
          <TImage
            source={require("../../../resource/images/workhard/search2.png")}
            style={{ width: 40, height: 40 }}
          />
        </TouchableOpacity>
        <NoticeIcon isWhite={true} authorization={this.props.authorization} />
      </View>
    );
  }

  _renderNavigationBarLeftButtonContent() {
    const jfdata = this.state.jfdata || {};
    if (jfdata.continue_days!=undefined) {
      return (
        <TouchableOpacity
          style={{
            marginLeft: -10,
            flexDirection: "row",
            alignItems: "center"
          }}
          onPress={() => {
            if (jfdata.is_today_signed===1) {
                this.gotoPage(Config.pages.jifenmall_qiandao_page, {});
            }else{
              new JifenMallToSignAction().call(this, {});
              setTimeout(() => {
                this.gotoPage(Config.pages.jifenmall_qiandao_page, {});
              }, 500);
            }        
          }}
        >
          <TImage
            source={require("../../../resource/images/home/jd_icon.png")}
            style={{ width: 54, height: 54 }}
          />
          <View style={{ marginLeft: 2 }}>
            <Text
              style={{
                color: "#fff",
                paddingLeft: 4,
                fontWeight: "bold",
                fontSize: 10
              }}
            >
              {"签到"}
            </Text>
            <Text
              style={{
                color: "#fff",
                marginTop: 0,
                fontWeight: "bold",
                fontSize: 10
              }}
            >
              {`连续${jfdata.continue_days}天`}
            </Text>
          </View>
        </TouchableOpacity>
      );
    } else {
      return <View />;
    }
  }

  // _onPressNavigationBarLeftBtn() {
  //   this.gotoPage(Config.pages.rili);
  // }

  _renderListView() {
    return (
      <CommonDataListView
        removeClippedSubviews={false}
        style={{
          marginTop: SizeUtils.translateDesignHeightToCode(0),
          height:
            this.props.style[0].height -
            SizeUtils.translateDesignHeightToCode(0)
        }}
        ref={ref => (this._listView = ref)}
        // onPressItem = {this._onPressItem.bind(this)}
        // onRenderItem = {this._onRenderItem.bind(this)}
        onRenderHeader={this._onRenderHeader.bind(this)}
        requestData={this._requestData.bind(this)}
        keyboardDismissMode={true}
        noEmpty={true}
      />
    );
  }

  _onRenderHeader() {
    return (
      <View
        style={{
          backgroundColor: "#eeeeee"
        }}
      >
        {this._renderViewPage()}
        <View style={{flex:1,flexDirection: "column",}}>
          {this._renderMidView()}
          <HomeAdView txt="文字广告轮播" leave={this.props.leave} />
          <RNList
            horizontal={true}
            showsVerticalScrollIndicator={false}
            enableEmptySections={true}
            showsHorizontalScrollIndicator={false}
            style={{
              backgroundColor: "#fff",
              paddingLeft: SizeUtils.translateDesignWidthToCode(15),
              marginBottom: SizeUtils.translateDesignHeightToCode(this.state.listData.length>0?20:0)
            }}
            dataSource={ds.cloneWithRows(this.state.listData)}
            renderRow={this._renderRow.bind(this)}
          />
          {this._renderMuduWeb()}
          {LIST_TYPES.map((data, index) => {
            return (
              <ListView
                data={data}
                pageData={this.props.pageData}
                index={index}
                key={index}
                updateMark={this.state.updateMark}
                notificationCall={this.props.notificationCall}
              />
            );
          })}
        </View>
      </View>
    );
  }
  _renderRow(data, index) {
    return (
      <ActivityItem
        isTop={true}
        data={data}
        loveData={this.state.loveData}
        key={index}
        number={index}
        type={this.props.data.type}
      />
    );
  }
  _renderMuduWeb() {
    if (this.props.leave === true || this.state.showMudu === false) {
      return;
    }
    var show = false;
    if (this.state.configDataDic["index_show_mudu"] != "0") {
      let data = this.state.configDataDic["index_show_mudu"].split(",");
      if (data[0] === "1" && data.length === 2) {
        show = true;
      }
      //http://mudu.tv/?a=index&c=show&id=39420&type=mobile
    }
    if (show) {
      return (
        <WebView
          source={this._getSource()}
          automaticallyAdjustContentInsets={true}
          style={{
            width: SizeUtils.getWindowSize().width,
            height:
              SizeUtils.getWindowSize().width * 0.56 +
              SizeUtils.translateDesignHeightToCode(10),
            backgroundColor: "#ffffff"
          }}
          javaScriptEnabled={true}
          injectedJavaScript=""
          allowsInlineMediaPlayback={true}
          domStorageEnabled={true}
          scalesPageToFit={true}
          scrollEnabled={false}
        />
      );
    }
  }

  _getSource() {
    let data = this.state.configDataDic["index_show_mudu"].split(",");
    return { uri: data[1] };

    // var content = `
    //   <iframe id="muduIframe" width="100%" height:"100%" frameborder="0"
    //       allowtransparency="yes" src="` + data[1] + `" onload="
    //         document.getElementById('muduIframe').style = 'height:' + document.body.clientWidth * 0.56 + 'px;border:0px;margin:0px;padding:0px;background-color:#ffffff';` +
    //         `document.getElementById('testDiv').innerHTML='width:' + document.body.clientWidth">
    //       </iframe>
    //   <div id="testDiv"></div>
    // `;
    // return HtmlUtils.getHtmlWeb(content);
  }

  _requestData(page, listView) {
    //page第几页
    //page_size每页几项
    //tag标签，0所有活动，1未开始活动，2进行中活动，3已结束活动 4 热门
    //show_last_days最近几天内
    // new ActivityRequestListAction().call(listView, {page:page, page_size:10, tag:0, show_last_days:7});
    this.setState({
      updateMark: this.state.updateMark + 1
    });
    this._viewPager.doRefresh();
    let requestTimer = setTimeout(() => {
      clearTimeout(requestTimer);
      listView.finish(1, []);
    }, 2000);
    new UserRequestAPPConfigAction().call(this, {
      key: "index_mid_buttons",
      requestType: "config"
    });
    new UserRequestAPPConfigAction().call(this, {
      key: "index_show_mudu",
      requestType: "config"
    });
    // new ActivityRequestListAction().call(this, {
    //   dataKey: "listData",
    //   page: 1,
    //   page_size: 6,
    //   tag: 2,
    //   home_page: 1
    // });
    new JifenMallSignHomeAction().call(this, { dataKey: "jfdata" });
    setTimeout(() => {
      this._checkQianDao();
    }, 1000);
  }

  _onPressBtnGroup(selectedIndex) {
    this.setState({ btnGroupSelectedIndex: selectedIndex });
  }
  _renderPage(data, pageID) {
    var lineArr=['1'];
    if (data.length>5) {
      lineArr.push('0');
    }
    return (
      <View style={{flexDirection: "column",
            width:SizeUtils.getWindowSize().width,
            padding: SizeUtils.translateDesignWidthToCode(30),
            paddingTop: SizeUtils.translateDesignNumToCode(40),
            paddingBottom: SizeUtils.translateDesignNumToCode(0),
            marginBottom: SizeUtils.translateDesignNumToCode(26),
            backgroundColor: "#ffffff"}} >
            {lineArr.map((fdata, index) => {
            return (
              <View
                key={index}
                style={{
                  flexDirection: "row",
                  justifyContent: "space-between",
                  paddingBottom: SizeUtils.translateDesignHeightToCode(30)
                }}
              >
                {data.map((button, buttonIndex) => {
                  if (buttonIndex<(index*5+5)&&index*5<=buttonIndex) {
                    return this._getPageButton(button, buttonIndex);
                  }
                })}
              </View>
            );
          })}
        
      </View>
    )
  }
  sliceArray(array, size) {
    var result = [];
    for (var x = 0; x < Math.ceil(array.length / size); x++) {
        var start = x * size;
        var end = start + size;
        result.push(array.slice(start, end));
    }
    return result;
  }
  //中部几个按钮
  _renderMidView() {
    var midButtons = this.state.configDataDic["index_mid_buttons"];    
    if (midButtons && midButtons.line > 0) {
      var arr = this.sliceArray(midButtons.button,10)
      if (arr[arr.length-1].length!==5) {
        var t =arr[arr.length-1];
        for (var i = 0; i < 5-arr[arr.length-1].length; i++) {
          t.push({test:'dfdf'})
        }
        arr[arr.length-1]=t;
      }
      return(
      <ViewPager
          style={{width:SizeUtils.getWindowSize().width,flexDirection: 'column',backgroundColor:'#fff'}}
          dataSource={this._dataSource.cloneWithPages(arr)}
          renderPage={this._renderPage.bind(this)}
          isLoop={false}
          renderPageIndicator={false}
          locked={arr.length===1}
          autoPlay={false}/>
    )
      var lineArr = new Array(midButtons.line);
      for (var i = 0; i < lineArr.length; i++) {
        lineArr[i] = "0";
      }
      return (
        <View
          style={{
            flexDirection: "column",
            padding: SizeUtils.translateDesignWidthToCode(30),
            paddingTop: SizeUtils.translateDesignNumToCode(40),
            paddingBottom: SizeUtils.translateDesignNumToCode(40),
            marginBottom: SizeUtils.translateDesignNumToCode(40),
            backgroundColor: "#ffffff"
          }}
        >
          {lineArr.map((data, index) => {
            return (
              <View
                key={index}
                style={{
                  flexDirection: "row",
                  justifyContent: "space-between",
                  paddingBottom: SizeUtils.translateDesignHeightToCode(15)
                }}
              >
                {midButtons.button.map((button, buttonIndex) => {
                  if (
                    buttonIndex >= index * midButtons.count &&
                    buttonIndex < (index + 1) * midButtons.count
                  ) {
                    return this._getPageButton(button, buttonIndex);
                  }
                })}
              </View>
            );
          })}
        </View>
      );
    }
  }

  _getPageButton(btnData, index) {
    if (btnData.test) {
      return(<View key={index} style={{width: SizeUtils.translateDesignWidthToCode(120),}}/>)
    }
    return (
      <TouchableOpacity
        key={index}
        onPress={() => this._onPressPageBtn(btnData)}
        style={{
          flexDirection: "column",
          width: SizeUtils.translateDesignWidthToCode(120),
          alignItems: "center"
        }}
      >
        <TImage
          resizeMode="contain"
          source={btnData.icon}
          style={{ width: 84, height: 84 }}
        />
        <Text
          style={[
            CommonStyles.secondaryText,
            {
              backgroundColor: "#00000000",
              marginTop: 2,
              color: "#666660",
              width: SizeUtils.translateDesignWidthToCode(120),
              textAlign: "center",
              fontSize: SizeUtils.translateFontSizeToCode(25)
            }
          ]}
        >
          {btnData.text}
        </Text>
      </TouchableOpacity>
    );
  }

  _onPressPageBtn(btnData) {
    if (btnData.isClose === true) {
      if (btnData.closeMessage != undefined) {
        ToastUtils.show(btnData.closeMessage);
      } else {
        ToastUtils.show("功能暂未开放");
      }
      return;
    }
    if (btnData.needLogin || btnData.needVerify) {
      new CommonCheckUserTypeAction().call(
        this,
        {
          needLogin: btnData.needLogin ? btnData.needLogin : false,
          needVerify: btnData.needVerify ? btnData.needVerify : false
        },
        result => this._onCheckIsUserHeart(result, btnData)
      );
    } else {
      if (Config.getPageDataByKey(btnData.goto)!==undefined) {
        this.gotoPage(Config.getPageDataByKey(btnData.goto));
      }
    }
  }

  _onCheckIsUserHeart(result, btnData) {
    // this.gotoPage(Config.pages.sport_dibiao_detail,{landmark_id:"59f89934ffc3c454575367e5"});
    if (result) {
      if (btnData.goto=='jifenmall_qiandao_page') {
        if (!this.state.jfdata) {return;}
          new CommonShowViewFullScreenAction().call(this, {
              component: QianDaoView,
              data: this.state.jfdata,
              updateMark: 0
            });
          return;
      }
      if (Config.getPageDataByKey(btnData.goto)!==undefined) {
        var obj ={};
        if (btnData.url) {
          obj={...btnData,title:btnData.text};
        }
        this.gotoPage(Config.getPageDataByKey(btnData.goto),obj);
      }
    }
  }

  //轮播图控件
  _renderViewPage() {
    // return (<CommonViewPager type="main"/>)
    return (
      <CommonViewPagerMultiShow
        ref={ref => (this._viewPager = ref)}
        type={Constants.SLIDER_TYPE.INDEX}
      />
    );
  }
}
class HomeAdView extends BaseComponent {
  constructor(props) {
    super(props);

    this.state = {
      txtBottom: 0,
      data: []
    };
    this._timer = 0;
    this.speed = 0;
    this.sleep = 0;
    this._itemHeight = SizeUtils.translateDesignHeightToCode(80);
    this._fps = 10;
    this._sleepTime = parseInt(4000 / this._fps); //5秒
    this._interval = null;
    this._timeInterval = null;
  }

  componentDidMount() {
    this._requestData();
    this._interval = setInterval(() => {
      this._updateInterval(this.state.txtBottom);
    }, this._fps);
  }
  componentWillUnmount() {
    this._interval && clearInterval(this._interval);
  }

  _updateInterval(value) {
    if (
      this.props.leave === false &&
      this.state.data &&
      this.state.data.length > 2
    ) {
      value += this.speed;
      if (value % this._itemHeight == 0) {
        this.speed = 0;
        this.sleep += 1;
        if (this.sleep == this._sleepTime) {
          //休眠5秒
          this.speed = 1;
          this.sleep = 0;
        }
      }
      if (value >= this.state.data.length * this._itemHeight / 2) {
        value = 0;
        this.speed = 0;
      }
      this.setState({ txtBottom: value });
    }
  }

  _requestData() {
    new CommonRequestSliderImagesAction().call(this, { tag: 8 }); //tag == 8
  }

  render() {
    return (
      <View
        style={{
          backgroundColor: "#ffffff",
          marginBottom: SizeUtils.translateDesignHeightToCode(20)
        }}
      >
        {this.renderContent()}
      </View>
    );
  }

  renderContent() {
    if (this.state.data && this.state.data.length > 0) {
      //if(1 == 2){
      let width = SizeUtils.getWindowSize().width;
      let left = 20;
      return (
        <View
          style={{
            overflow: "hidden",
            width: width,
            height: SizeUtils.translateDesignWidthToCode(100)
          }}
        >
          <View style={{ margin: 12, marginLeft: 15 }}>
            <TImage
              source={require("../../../resource/images/home/zixun.png")}
              style={{ width: 60, height: 60 }}
            />
          </View>
          <ScrollView
            style={{
              position: "absolute",
              width: width - SizeUtils.translateDesignWidthToCode(10),
              height: SizeUtils.translateDesignWidthToCode(80),
              top: SizeUtils.translateDesignWidthToCode((100 - 70) / 2),
              left: 50 + left
            }}
          >
            <View
              style={{
                width: width - SizeUtils.translateDesignWidthToCode(190),
                top: -this.state.txtBottom,
                height: SizeUtils.translateDesignWidthToCode(40)
              }}
            >
              {this.renderTxts()}
            </View>
          </ScrollView>
        </View>
      );
    } else {
      return <View />;
    }
  }

  renderTxtItem(item, index) {
    return (
      <View
        key={index}
        style={{
          width:
            SizeUtils.getWindowSize().width -
            SizeUtils.translateDesignHeightToCode(860),
          height: SizeUtils.translateDesignHeightToCode(40),
          flexDirection: "row",
          justifyContent: "flex-start",
          alignItems: "center"
        }}
      >
        <TouchableOpacity onPress={() => this._pressTxt(item)}>
          <Text
            style={{
              fontSize: SizeUtils.translateFontSizeToCode(24),
              width: SizeUtils.translateDesignHeightToCode(505)
            }}
            numberOfLines={1}
          >
            {item.desc}
          </Text>
        </TouchableOpacity>
      </View>
    );
  }

  _pressTxt(data) {
    if (data && data.link != "") {
      new JumpToPageByUrlAction().call(this, data);
    }
  }

  renderTxts() {
    return this.state.data.map((item, index) =>
      this.renderTxtItem(item, index)
    );
  }
}

import RequestNewsPostsAction from "../../actions/news/RequestNewsPostsAction";
import CommonViewPagerOne from "../common/CommonViewPagerOne";
import WH_RequestPostsAction from "../../actions/workhard/WH_RequestPostsAction";
import ActivityRequestListAction from "../../actions/activity/ActivityRequestListAction";
import HeartExpertsTodayListAction from "../../actions/heart/HeartExpertsTodayListAction";
import HeartEapRequestAction from "../../actions/heart/HeartEapRequestAction";
import HeartRequestZJMsgCountAction from "../../actions/heart/HeartRequestZJMsgCountAction";
import HeartLoveRequestUsersAction from "../../actions/heart/HeartLoveRequestUsersAction";
import HeartLoveRquestSelfDataAction from "../../actions/heart/HeartLoveRquestSelfDataAction";
import VipActivityRequestListAction from "../../actions/vipsercard/VipActivityRequestListAction";
import NewsListItemView from "../news/NewsListItemView";
import WH_PostItemView from "../workhard/WH_PostItemView";
import ActivityListItemView from "../activity/ActivityListItemView";
import HeartEapItemView from "../heart/HeartEapHomeItemView";
import CommonAvatarView from "../common/CommonAvatarView";
import QuanziPostListItemView from "../quanzi/QuanziPostListItemView";
import QZ_RequestQuanziListAction from "../../actions/quanzi/QZ_RequestQuanziListAction";
import RendRequestQuanziHoemTuijianAction from "../../actions/quanzi/RendRequestQuanziHoemTuijianAction";

var ds = new RNList.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });

class ListView extends BaseComponent {
  constructor(props) {
    super(props);

    this.state.listData = [];
    this.state.quanziData = [];
    this._timer = null;
  }

  componentDidMount() {
    // this._requestData();
  }

  componentWillUpdate(nextProps, nextState) {
    if (nextState.isResponeUpdate == true) {
      nextState.isResponeUpdate = false;
      if (nextState.data && nextState.data instanceof Array) {
        nextState.listData = nextState.data;
      } else {
        nextState.listData = [];
      }
    }
    if (this.props.updateMark != nextProps.updateMark) {
      this._requestData();
    }
  }

  render() {
    if (!this.state.listData || this.state.listData.length === 0) {
      // if(this.state.listData.length === 0 || this._checkHasImage() === false) {
      return <View />;
    }
    let listData =
      this.props.data.type === "quanzi"
        ? (this.state.quanziData && this.state.quanziData.posts) || []
        : this.state.listData;
    const topData =
      this.props.data.type === "quanzi"
        ? (this.state.quanziData && this.state.quanziData.official) || []
        : [];
    if (this.props.data.type === "quanzi") {
      listData = listData.slice(
        0,
        Math.min(this.props.data.page_size, listData.length)
      );
    }
    return (
      <View
        style={[
          this.props.style,
          {
            marginBottom: SizeUtils.translateDesignHeightToCode(20),
            backgroundColor: "#ffffff"
          }
        ]}
      >
        {this._renderHeader()}
        <ListViewTopView data={this.props.data} quanziData={topData} />
        {this.props.data.type === "workHard"&&LIST_TYPES_WORD.map(
            (data, index) => {
              return <RListView  data={data} index={index} key={index}  updateMark={0}/>
            }
          )}
        {this.props.data.type === "activity" ||
        this.props.data.type === "heart_love" ? (
          <RNList
            horizontal={true}
            style={{ marginLeft: 10, marginRight: 10 }}
            showsVerticalScrollIndicator={false}
            enableEmptySections={true}
            showsHorizontalScrollIndicator={false}
            dataSource={ds.cloneWithRows(this.state.listData)}
            renderRow={this._renderRow.bind(this)}
          />
        ) : (
          listData.map((data, index) => {
            return this._renderItem(data, index);
          })
        )}
      </View>
    );
  }
  _checkHasImage() {
    let data = null;
    for (var i = 0; i < this.state.listData.length; i++) {
      data = this.state.listData[i];
      if (
        data.image_url ||
        (data.image_urls && data.image_urls && data.image_urls.length > 0)
      ) {
        return true;
      }
    }
    return false;
  }
  _renderRow(data, index) {
    return (
      <ActivityItem
        data={data}
        loveData={this.state.loveData}
        key={index}
        number={index}
        type={this.props.data.type}
      />
    );
  }
  _renderItem(data, index) {
    if (this.props.data.type == "activity") {
      return <ActivityListItemView data={data} key={index} />;
    } else if (this.props.data.type == "heart_eap") {
      return <HeartEapItemView data={data} key={index} />;
    } else if (this.props.data.type == "quanzi") {
      return (
        <QuanziPostListItemView
          user_id={this.props.pageData.routeData.userData.user_id}
          data={data.post}
          is_follow={data.is_follow}
          boardName={data.boardName}
          key={index}
        />
      );
    } else {
      //有图片才显示
      // else if(data.image_url || (data.image_urls && data.image_urls && data.image_urls.length > 0)) {
      return (
        <Item
          data={data}
          key={index}
          number={index}
          type={this.props.data.type}
        />
      );
    }
  }

  _renderHeader() {
    let moreStr = "更多内容 >";
    if (this.props.data.type === "news") {
      moreStr = "更多资讯 >";
    } else if (this.props.data.type === "activity") {
      moreStr = "更多活动 >";
    } else if (this.props.data.type === "heart_love") {
      moreStr = "更多爱情 >";
    } else if (this.props.data.type === "heart_eap") {
      moreStr = "更多EAP活动 >";
    } else if (this.props.data.type === "vipsercard_content") {
      moreStr = "更多会员活动 >";
    } else if (this.props.data.type === "zhibo") {
      moreStr = "";
    }
    return (
      <View
        style={{
          flexDirection: "row",
          paddingLeft: SizeUtils.translateDesignWidthToCode(30),
          paddingRight: SizeUtils.translateDesignWidthToCode(30),
          paddingBottom: SizeUtils.translateDesignHeightToCode(20),
          justifyContent: "space-between",
          paddingTop: SizeUtils.translateDesignHeightToCode(30),
          alignItems: "center"
        }}
      >
        <View style={{ flexDirection: "row", alignItems: "center" }}>
          <TImage
            source={require("../../../resource/images/home/biaotitle.png")}
            style={{ width: 8, height: 30 }}
          />
          <Text
            style={{
              fontSize: SizeUtils.translateFontSizeToCode(28),
              color: "#333333",
              marginLeft: SizeUtils.translateDesignWidthToCode(8),
              borderWidth: 0,
              backgroundColor: "#00000000",
              fontWeight: "bold"
            }}
          >
            {this.props.data.headerTitle}
          </Text>
        </View>
        <TouchableOpacity onPress={this._onPressMore.bind(this)}>
          <Text
            style={{
              fontSize: SizeUtils.translateFontSizeToCode(24),
              color: "#888888"
            }}
          >
            {moreStr}
          </Text>
        </TouchableOpacity>
      </View>
    );
  }

  _onPressMore() {
    // this.gotoPage(Config.pages.workHard_write);
    // return;
    if (this.props.data.type == "news") {
      if (this.props.notificationCall) {
        this.props.notificationCall({ type: "changeTab", value: "news" });
      }
    } else if (this.props.data.type == "workHard") {
      this.gotoPage(Config.pages.workHard);
    } else if (this.props.data.type == "activity") {
      this.gotoPage(Config.pages.activity);
    }else if (this.props.data.type == "heart_love") {
      this.gotoPage(Config.pages.heart_love);
    } else if (this.props.data.type == "heart_eap") {
      this.gotoPage(Config.pages.heart_main);
    } else if (this.props.data.type == "vipsercard_content") {
      const rowData = {
        bbWidth: SizeUtils.translateDesignNumToCode(3),
        imgurl: require("../../../resource/images/vipsercard/huodong.png"),
        width: 120,
        height: 120,
        title: "会员活动",
        showType: 1,
        dsc: "",
        pageKey: Config.pages.vipActivityXianshiPage.key
      };
      var pageData = Config.getPageDataByKey(rowData.pageKey);
      this.gotoPage(pageData, { buttonData: rowData });
    } else if (this.props.data.type === "quanzi") {
      this.gotoPage(Config.pages.quanzi_main);
    }
  }

  _requestData() {
    this._timer = setTimeout(() => {
      clearTimeout(this._timer);
      this._timerComplete();
    }, 200 * this.props.index);
  }

  _timerComplete() {
    if (this.props.data.type == "news") {
      new RequestNewsPostsAction().call(this, {
        page: 1,
        page_size: this.props.data.page_size,
        tag: 0,
        home_page: 1
      });
    } else if (this.props.data.type == "zhibo") {
      new CommonLiveAction().call(this, { tag: 2 });
    } else if (this.props.data.type == "workHard") {
      this.setState({
        listData:[1] 
      });
      // new WH_RequestPostsAction().call(this, {
      //   sort_id: 1,
      //   page: 1,
      //   page_size: this.props.data.page_size,
      //   home_page: 1
      // });
    } else if (this.props.data.type == "activity") {
      new ActivityRequestListAction().call(this, {
        page: 1,
        page_size: this.props.data.page_size,
        tag: 5,
        type:1,
        home_page: 1
      });
    } else if (this.props.data.type == "heart_love") {
      new HeartLoveRequestUsersAction().call(this, { page: 1, sort_id: 1 });
      new HeartLoveRquestSelfDataAction().call(this);
    } else if (this.props.data.type == "heart_eap") {
      new HeartEapRequestAction().call(this, {
        page: 1,
        tag: 0,
        page_size: this.props.data.page_size,
        home_page: 1
      });
    } else if (this.props.data.type == "vipsercard_content") {
      new VipActivityRequestListAction().call(this, {
        sort_id: 1,
        page: 1,
        tag: 0,
        page_size: this.props.data.page_size,
        home_page: 1
      });
    } else if (this.props.data.type == "quanzi") {
      new RendRequestQuanziHoemTuijianAction().call(this, { page: 1 });
    }
  }
}

const LIST_TYPES_WORD = [
  {type:"gonggao", headerTitle:"通知公告", hasMoreBtn:true, page_size:2,},
  {type:"online", headerTitle:"精彩在线", hasMoreBtn:true, page_size:2,},
];

import CommonRequestADAction from '../../actions/common/CommonRequestADAction';

class RListView extends BaseComponent {
  constructor(props) {
    super(props);

    this.state.listData = [];
    this._timer = null;
  }
  componentDidMount() {
    this._requestData();
  }
    _workHardBottomView = (data) => (
    <View
      style={{
        flexDirection: "row",
        paddingLeft: SizeUtils.translateDesignWidthToCode(18),
        paddingRight: SizeUtils.translateDesignWidthToCode(25),
        paddingTop: SizeUtils.translateDesignHeightToCode(10),
        alignItems: "center"
      }}
    >
      <Text
        numberOfLines={1}
        style={[
          CommonStyles.secondaryText,
          {
            flex: 1,
            marginRight: SizeUtils.translateDesignWidthToCode(60),
            fontSize: SizeUtils.translateFontSizeToCode(26)
          }
        ]}
      >
        {data.content}
      </Text>
      <View style={{ flexDirection: "row" }}>
        <Text
          style={[
            CommonStyles.secondaryText,
            { marginLeft: 5, fontSize: SizeUtils.translateFontSizeToCode(24) }
          ]}
        >
          {DateUtils.formatDiffFromServerTime(data.posted_at)}
        </Text>
      </View>
    </View>
  );
  _onPressItem(data){
    this.gotoPage(Config.pages.quanzi_post_content, {...data,isGongGao:true});
    // this.gotoPage(Config.pages.news_content, data);
  }
  _renderItem(data, index) {
    const title =this.props.data.type == "gonggao"?'通知公告':'精彩在线';
    return( <TouchableOpacity
            key={'d'+index}
          onPress={()=>{this._onPressItem(data)}}
          style={{
            flex: 1,
            flexDirection: "row",
            paddingTop: SizeUtils.translateDesignHeightToCode(10),
            paddingBottom: SizeUtils.translateDesignHeightToCode(10),
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee",
            paddingLeft: SizeUtils.translateDesignWidthToCode(0),
            paddingRight: SizeUtils.translateDesignWidthToCode(0)
          }}
        >
          <View
            style={{
              flex: 1,
              flexDirection: "column",
              justifyContent: "space-between",
              paddingLeft: SizeUtils.translateDesignWidthToCode(10),
              paddingRight: SizeUtils.translateDesignWidthToCode(10),
              paddingTop: SizeUtils.translateDesignHeightToCode(10),
              paddingBottom: SizeUtils.translateDesignHeightToCode(10)
            }}
          >
            <Text
              numberOfLines={1}
              style={[
                CommonStyles.primaryText,
                {
                  marginTop: SizeUtils.translateDesignHeightToCode(10),
                  marginBottom: SizeUtils.translateDesignHeightToCode(10),
                  fontWeight: "bold",
                  color: "#000",
                  fontSize: SizeUtils.translateFontSizeToCode(30)
                }
              ]}
            >
              <Text style={{ color: "#ff6600" }}>
                {"【" +
                  title +
                  "】"}
              </Text>
              {data.title}
            </Text>
            {this._workHardBottomView(data)}
          </View>
        </TouchableOpacity>
      );
  }
  _requestData() {
    this._timer = setTimeout(()=>{
      clearTimeout(this._timer);
      this._timerComplete();
    }, 200 * this.props.index);
  }
  _timerComplete() {
    if(this.props.data.type == "gonggao") {
      new CommonRequestADAction().call(this, {tag:5,page_size:2}); //公告 5
    }else{
      new CommonRequestADAction().call(this, {tag:6,page_size:2}); //公告 5
    }
  }

  render() {
    if(!this.state.data||this.state.data.length === 0) {
      return (<View></View>)
    }
    const arr =this.state.data.slice(0,Math.min(2,this.state.data.length));
    return(
      <View style={[this.props.style,{marginBottom:SizeUtils.translateDesignHeightToCode(20),
          backgroundColor:'#ffffff'}]}>
      {arr.map(
            (data, index) => {
              return this._renderItem(data, index);
            }
        )}
    </View>
    );
  }
}

class ListViewTopView extends BaseComponent {
  constructor(props) {
    super(props);

    this.state.listData = [];
    this._timer = null;
  }
  componentDidMount() {
    this._timerComplete();
  }
  componentWillUpdate(nextProps, nextState) {
    if (nextState.isResponeUpdate == true) {
      nextState.isResponeUpdate = false;
      if (nextState.data && nextState.data instanceof Array) {
        nextState.listData = nextState.data;
      } else {
        nextState.listData = [];
      }
    }
    if (this.props.updateMark != nextProps.updateMark) {
      this._timerComplete();
    }
  }
  _onHeartPressItem(data) {
    data.type = 2;
    data.recommended = true;
    this.gotoPage(Config.pages.heart_expert_data, data);
  }
  _timerComplete() {
    if (this.props.data.type == "heart_eap") {
      new HeartExpertsTodayListAction().call(this,{});
    }
    if (this.props.data.type == "quanzi") {
      if (this.props.quanziData) {
        this.setState({
          listData: this.props.quanziData
        });
      }
    }
    if (this.props.data.type == "heart_love") {
      this._viewPagers && this._viewPagers.doRefresh();
    }
  }
  _getImageSource(data) {
    if (data.avatar_url) {
      return { uri: data.avatar_url };
    } else {
      return { uri: "" };
    }
  }
  _getQuanziImageSource(data) {
    if (data.image_url) {
      return { uri: data.image_url };
    } else if (
      data.image_urls &&
      data.image_urls &&
      data.image_urls.length > 0
    ) {
      return { uri: data.image_urls[0] };
    } else {
      return { uri: "" };
    }
  }
  _onPressItem(data) {
    this.gotoPage(Config.pages.quanzi_content, data);
  }
  _renderQuanziRow(data, index) {
    return (
      <TouchableOpacity
        onPress={() => {
          this._onPressItem(data);
        }}
        style={{
          flex: 1,
          overflow: "hidden",
          alignItems: "center",
          justifyContent: "center",
          width: SizeUtils.translateDesignWidthToCode(140),
          height: SizeUtils.translateDesignHeightToCode(180),
          marginTop: SizeUtils.translateDesignHeightToCode(20),
          marginBottom: SizeUtils.translateDesignHeightToCode(20),
          marginLeft: SizeUtils.translateDesignWidthToCode(15),
          borderRadius: 4
        }}
      >
        <CommonAvatarView
          avatarUri={this._getQuanziImageSource(data)}
          size={124}
        />
        <Text
          numberOfLines={1}
          style={[
            CommonStyles.primaryText,
            {
              marginTop: SizeUtils.translateDesignHeightToCode(10),
              color: "#000",
              fontSize: SizeUtils.translateFontSizeToCode(24)
            }
          ]}
        >
          {data.title}
        </Text>
      </TouchableOpacity>
    );
  }
  _onRenderVIPCARD(index) {
    this.gotoPage(Config.pages.post_common_web, {
      url: VIPCARDARR[index].url,
      title: VIPCARDARR[index].title
    });
  }
  _onPressCallTel(index){
    const TelArr =['0459-5970101','0459-5970909','0459-5982977','0459-5982677'];
    Linking.openURL('tel:'+TelArr[index])
  }
  render() {
    if (this.props.data.type === "heart_love") {
      return (
        <View
          style={{
            width:
              SizeUtils.getWindowSize().width -
              SizeUtils.translateDesignWidthToCode(40),
            marginTop: SizeUtils.translateDesignHeightToCode(20),
            marginBottom: SizeUtils.translateDesignHeightToCode(10),
            marginLeft: SizeUtils.translateDesignWidthToCode(20),
            marginRight: SizeUtils.translateDesignWidthToCode(20),
            height: SizeUtils.translateDesignWidthToCode(320),
            borderRadius: 4,
            overflow: "hidden"
          }}
        >
          <CommonViewPagerOne
            ref={ref => (this._viewPagers = ref)}
            isMain={true}
            type={Constants.SLIDER_TYPE.HEART_LOVE}
            style={{
              width:
                SizeUtils.getWindowSize().width -
                SizeUtils.translateDesignWidthToCode(40),
              marginTop: SizeUtils.translateDesignHeightToCode(20),
              height: SizeUtils.translateDesignWidthToCode(320)
            }}
          />
        </View>
      );
    }
    if (this.props.data.type === "quanzi") {
      return (
        <RNList
          style={{
            marginLeft: SizeUtils.translateDesignWidthToCode(10),
            borderTopWidth: SizeUtils.translateDesignNumToCode(3),
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee"
          }}
          horizontal={true}
          enableEmptySections={true}
          showsHorizontalScrollIndicator={false}
          dataSource={ds.cloneWithRows(this.state.listData)}
          renderRow={this._renderQuanziRow.bind(this)}
        />
      );
    }
    if (this.props.data.type === "vipsercard_content") {
      return (
        <View
          style={{
            borderTopWidth: SizeUtils.translateDesignNumToCode(3),
            height: SizeUtils.translateDesignHeightToCode(124),
            justifyContent: "space-around",
            alignItems: "center",
            flexDirection: "row",
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee"
          }}
        >
          {VIPCARDARR.map((item, index) => {
            return (
              <TouchableOpacity
                key={index}
                style={{
                  alignItems: "center",
                  justifyContent: "center",
                  borderRadius: 4,
                  backgroundColor: "#f6f7fa",
                  width: SizeUtils.translateDesignWidthToCode(150),
                  height: SizeUtils.translateDesignHeightToCode(84)
                }}
                onPress={() => {
                  this._onRenderVIPCARD(index);
                }}
              >
                <Text
                  style={{
                    color: "#000",
                    fontWeight: "bold",
                    fontSize: 14
                  }}
                >
                  {item.title}
                </Text>
              </TouchableOpacity>
            );
          })}
        </View>
      );
    }
    if (this.props.data.type !== "heart_eap"&&this.state.listData.length === 0) {
      return <View />;
    }
    if (this.props.data.type === "heart_eap") {
      const item = this.state.listData[0];
      const item1 = this.state.listData[1];
      return (
        <View
          style={{
            flex: 1,
            backgroundColor: "#fff",
            shadowColor: "rgba(0,0,0, 0.4)",
            shadowOffset: { height: 3, width: 3 },
            shadowOpacity: 0.2,
            elevation: 6,
            shadowRadius: 1,
            margin: SizeUtils.translateDesignHeightToCode(30),
            borderWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee",
            borderRadius: 4
          }}
        >
        <View
            style={{
              height: SizeUtils.translateDesignHeightToCode(180),
              backgroundColor: "#f8f8f8",
              flexDirection: "row",
              justifyContent: "space-around",
              alignItems: "center"
            }}
          >
            <TouchableOpacity onPress={()=>{this._onPressCallTel(0)}} style={{ alignItems: "center" }}>
              <Image
                source={require("../../../resource/images/heart/aiqingshi/falu.png")}
                style={{ width: 45, height: 45 }}
                resizeMode={"cover"}
              />
              <Text style={{ color: "#000", fontSize: 12 }}>{"法律咨询"}</Text>
            </TouchableOpacity>
            <TouchableOpacity onPress={()=>{this._onPressCallTel(1)}} style={{ alignItems: "center" }}>
              <Image
                source={require("../../../resource/images/heart/aiqingshi/xinli.png")}
                style={{ width: 45, height: 45 }}
                resizeMode={"cover"}
              />
              <Text style={{ color: "#000", fontSize: 12 }}>{"心理咨询"}</Text>
            </TouchableOpacity>
            <TouchableOpacity onPress={()=>{this._onPressCallTel(2)}} style={{ alignItems: "center" }}>
              <Image
                source={require("../../../resource/images/heart/aiqingshi/vipcard.png")}
                style={{ width: 45, height: 45 }}
                resizeMode={"cover"}
              />
              <Text style={{ color: "#000", fontSize: 12 }}>{"会员卡咨询"}</Text>
            </TouchableOpacity>
            <TouchableOpacity onPress={()=>{this._onPressCallTel(3)}} style={{ alignItems: "center" }}>
              <Image
                source={require("../../../resource/images/heart/aiqingshi/yuyue.png")}
                style={{ width: 45, height: 45 }}
                resizeMode={"cover"}
              />
              <Text style={{ color: "#000", fontSize: 12 }}>{"预约服务"}</Text>
            </TouchableOpacity>
          </View>
          {
            item===undefined&&item1===undefined?
            <View style={{
              alignItems: 'center',
              justifyContent: 'center',
              height: SizeUtils.translateDesignHeightToCode(400)
            }}>
              <Text style={{fontSize:17}}>今日无值班专家</Text>
            </View>:null
          }
          {item?<TouchableOpacity
            style={{
              flex:1,
              height: SizeUtils.translateDesignHeightToCode(200),
              alignItems: "center",
              flexDirection: "row",
            }}
            onPress={() => {
              this._onHeartPressItem(item);
            }}
          >
            <View
              style={{
                width: SizeUtils.translateDesignHeightToCode(140),
                height: SizeUtils.translateDesignHeightToCode(140),
                marginLeft: SizeUtils.translateDesignWidthToCode(80),
                marginRight: SizeUtils.translateDesignWidthToCode(50),
                borderRadius: SizeUtils.translateDesignHeightToCode(70),
                overflow: "hidden"
              }}
            >
              <TImage
                source={this._getImageSource(item)}
                style={{
                  width: 140,
                  height: 140
                }}
                resizeMode={"cover"}
              />
            </View>
            <View
              style={{ height: SizeUtils.translateDesignHeightToCode(140),flex:1, }}
            >
              <Text
                numberOfLines={1}
                style={[
                  CommonStyles.primaryText,
                  {
                    marginTop: SizeUtils.translateDesignHeightToCode(5),
                    marginBottom: SizeUtils.translateDesignHeightToCode(5),
                    color: "#0a0a0a",
                    fontSize: SizeUtils.translateFontSizeToCode(30)
                  }
                ]}
              >
                {item.name}
              </Text>
              <Text
                numberOfLines={1}
                style={[
                  CommonStyles.primaryText,
                  {
                    marginTop: SizeUtils.translateDesignHeightToCode(15),
                    marginBottom: SizeUtils.translateDesignHeightToCode(10),
                    color: "#7f7f7f",
                    fontSize: SizeUtils.translateFontSizeToCode(28)
                  }
                ]}
              >
                {item.title}
              </Text>
              <View style={{ flexDirection: "row" }}>
                <View
                  style={{
                    height: SizeUtils.translateDesignHeightToCode(28),
                    padding: SizeUtils.translateDesignWidthToCode(4),
                    paddingLeft: SizeUtils.translateDesignWidthToCode(10),
                    paddingRight: SizeUtils.translateDesignWidthToCode(10),
                    backgroundColor: "#49c4fa",
                    alignItems: "center",
                    justifyContent: "center",
                    borderRadius: SizeUtils.translateDesignHeightToCode(14)
                  }}
                >
                  <Text style={{ color: "#fff", fontSize: 12 }}>
                    {"今日值班专家"}
                  </Text>
                </View>
              </View>
            </View>
          </TouchableOpacity>:null}
          {item1 ? (
            <View
              style={{
                height: 1,
                marginLeft: 30,
                marginRight: 30,
                backgroundColor: "#f2f2f2"
              }}
            />
          ) : null}
          {item1 ? (
            <TouchableOpacity
              style={{
                flex:1,
                height: SizeUtils.translateDesignHeightToCode(200),
                alignItems: "center",
                flexDirection: "row",
              }}
              onPress={() => {
                this._onHeartPressItem(item1);
              }}
            >
              <View
                style={{
                  width: SizeUtils.translateDesignHeightToCode(140),
                  height: SizeUtils.translateDesignHeightToCode(140),
                  marginLeft: SizeUtils.translateDesignWidthToCode(80),
                  marginRight: SizeUtils.translateDesignWidthToCode(50),
                  borderRadius: SizeUtils.translateDesignHeightToCode(70),
                  overflow: "hidden"
                }}
              >
                <TImage
                  source={this._getImageSource(item1)}
                  style={{
                    width: 140,
                    height: 140
                  }}
                  resizeMode={"cover"}
                />
              </View>
              <View
                style={{ height: SizeUtils.translateDesignHeightToCode(140),flex:1, }}
              >
                <Text
                  numberOfLines={1}
                  style={[
                    CommonStyles.primaryText,
                    {
                      marginTop: SizeUtils.translateDesignHeightToCode(5),
                      marginBottom: SizeUtils.translateDesignHeightToCode(5),
                      color: "#0a0a0a",
                      fontSize: SizeUtils.translateFontSizeToCode(30)
                    }
                  ]}
                >
                  {item1.name}
                </Text>
                <Text
                  numberOfLines={1}
                  style={[
                    CommonStyles.primaryText,
                    {
                      marginTop: SizeUtils.translateDesignHeightToCode(15),
                      marginBottom: SizeUtils.translateDesignHeightToCode(10),
                      color: "#7f7f7f",
                      fontSize: SizeUtils.translateFontSizeToCode(28)
                    }
                  ]}
                >
                  {item1.title}
                </Text>
                <View style={{ flexDirection: "row" }}>
                  <View
                    style={{
                      height: SizeUtils.translateDesignHeightToCode(28),
                      padding: SizeUtils.translateDesignWidthToCode(4),
                      paddingLeft: SizeUtils.translateDesignWidthToCode(10),
                      paddingRight: SizeUtils.translateDesignWidthToCode(10),
                      backgroundColor: "#49c4fa",
                      alignItems: "center",
                      justifyContent: "center",
                      borderRadius: SizeUtils.translateDesignHeightToCode(14)
                    }}
                  >
                    <Text style={{ color: "#fff", fontSize: 12 }}>
                      {"今日值班专家"}
                    </Text>
                  </View>
                </View>
              </View>
            </TouchableOpacity>
          ) : null}
        </View>
      );
    }
    return <View />;
  }
}
class ActivityItem extends BaseItem {
  constructor(props) {
    super(props);
  }
  _onPressItem() {
    if (this.props.type === "activity" || this.props.type === undefined) {
      this.gotoPage(Config.pages.activity_content, this.props.data);
    }
    if (this.props.type === "heart_love") {
      this.gotoPage(Config.pages.heart_love_other_data, {
        loveData: this.props.data,
        myLoveData: this.props.loveData
      });
    }
  }
  _renderShowImage(data) {
    if (
      data.image_url ||
      (data.image_urls && data.image_urls && data.image_urls.length > 0)
    ) {
      return (
        <TImage
          source={this._getImageSource(data)}
          style={{ width: 280, height: 168 }}
          resizeMode={"cover"}
          isMini={true}
        />
      );
    }
  }
  _renderShowTopImage(data) {
    if (
      data.image_url ||
      (data.image_urls && data.image_urls && data.image_urls.length > 0)
    ) {
      return (
        <TImage
          source={this._getImageSource(data)}
          style={{ width: 220, height: 120 }}
          resizeMode={"cover"}
          isMini={true}
        />
      );
    }
  }
  _getImageSource(data) {
    if (data.image_url) {
      return { uri: data.image_url };
    } else if (
      data.image_urls &&
      data.image_urls &&
      data.image_urls.length > 0
    ) {
      return { uri: data.image_urls[0] };
    } else {
      return { uri: "" };
    }
  }
  _getTimeStr(time) {
    var timeStr = DateUtils.formatHomeActivity(time);
    return timeStr;
  }
  render() {
    const { number, data, type, isTop } = this.props;
    if (isTop) {
      return (
        <TouchableOpacity
          onPress={this._onPressItem.bind(this)}
          style={{
            flex: 1,
            overflow: "hidden",
            alignItems: "center",
            width: SizeUtils.translateDesignWidthToCode(220),
            marginTop: SizeUtils.translateDesignHeightToCode(20),
            marginBottom: SizeUtils.translateDesignHeightToCode(20),
            marginLeft: SizeUtils.translateDesignWidthToCode(10),
            borderWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee",
            borderRadius: 3
          }}
        >
          {this._renderShowTopImage(this.props.data)}
          <Text
            numberOfLines={1}
            style={[
              CommonStyles.primaryText,
              {
                marginTop: SizeUtils.translateDesignHeightToCode(18),
                marginBottom: SizeUtils.translateDesignHeightToCode(10),
                color: "#000",
                fontSize: SizeUtils.translateFontSizeToCode(22)
              }
            ]}
          >
            {this.props.data.title}
          </Text>
        </TouchableOpacity>
      );
    }
    if (type === "heart_love") {
      return (
        <TouchableOpacity
          onPress={this._onPressItem.bind(this)}
          style={{
            flex: 1,
            overflow: "hidden",
            alignItems: "center",
            width: SizeUtils.translateDesignWidthToCode(150),
            marginTop: SizeUtils.translateDesignHeightToCode(20),
            marginBottom: SizeUtils.translateDesignHeightToCode(20),
            marginLeft: SizeUtils.translateDesignWidthToCode(0),
            marginRight: SizeUtils.translateDesignWidthToCode(6)
          }}
        >
          <CommonAvatarView avatarUri={this._getImageSource(data)} size={130} />
          <Text
            numberOfLines={1}
            style={[
              CommonStyles.primaryText,
              {
                marginTop: SizeUtils.translateDesignHeightToCode(14),
                marginBottom: SizeUtils.translateDesignHeightToCode(5),
                height: SizeUtils.translateDesignHeightToCode(40),
                color: "#000",
                fontSize: SizeUtils.translateFontSizeToCode(30)
              }
            ]}
          >
            {data.nick}
          </Text>
          <View
            style={{
              height: SizeUtils.translateDesignHeightToCode(40),
              marginBottom: SizeUtils.translateDesignHeightToCode(10),
              justifyContent: "center",
              alignItems: "center"
            }}
          >
            <Text
              numberOfLines={1}
              style={[
                CommonStyles.primaryText,
                {
                  color: "#968a88",
                  fontSize: SizeUtils.translateFontSizeToCode(26)
                }
              ]}
            >
              {data.gender == 1 ? "男" : "女" + " " + data.height + "cm"}
            </Text>
          </View>
          <View
            style={{
              height: SizeUtils.translateDesignHeightToCode(28),
              paddingLeft: SizeUtils.translateDesignWidthToCode(10),
              paddingRight: SizeUtils.translateDesignWidthToCode(10),
              backgroundColor: "#ffae05",
              alignItems: "center",
              justifyContent: "center",
              borderRadius: SizeUtils.translateDesignHeightToCode(14)
            }}
          >
            <Text numberOfLines={1} style={{ color: "#fff", fontSize: 12 }}>
              {data.department.substr(0, Math.min(5, data.department.length))}
            </Text>
          </View>
        </TouchableOpacity>
      );
    }
    return (
      <TouchableOpacity
        onPress={this._onPressItem.bind(this)}
        style={{
          flex: 1,
          overflow: "hidden",
          alignItems: "center",
          width: SizeUtils.translateDesignWidthToCode(280),
          marginTop: SizeUtils.translateDesignHeightToCode(20),
          marginBottom: SizeUtils.translateDesignHeightToCode(20),
          marginRight: SizeUtils.translateDesignWidthToCode(8),
          borderWidth: SizeUtils.translateDesignNumToCode(3),
          borderColor: "#eeeeee",
          borderRadius: 4
        }}
      >
        {this._renderShowImage(this.props.data)}
        <Text
          numberOfLines={1}
          style={[
            CommonStyles.primaryText,
            {
              marginTop: SizeUtils.translateDesignHeightToCode(25),
              marginBottom: SizeUtils.translateDesignHeightToCode(15),
              color: "#000",
              fontSize: SizeUtils.translateFontSizeToCode(26)
            }
          ]}
        >
          {this.props.data.title}
        </Text>
        <Text
          style={[
            CommonStyles.secondaryText,
            {
              fontSize: SizeUtils.translateFontSizeToCode(20),
              textAlign: "center",
              paddingTop: SizeUtils.translateDesignHeightToCode(0)
            }
          ]}
        >
          {this._getTimeStr(this.props.data.begin_at) + " 活动开始"}
        </Text>
        <View
          style={{
            height: SizeUtils.translateDesignHeightToCode(54),
            marginTop: SizeUtils.translateDesignHeightToCode(20),
            marginBottom: SizeUtils.translateDesignHeightToCode(20),
            width: SizeUtils.translateDesignWidthToCode(200),
            backgroundColor: "#f4685c",
            alignItems: "center",
            justifyContent: "center",
            borderRadius: SizeUtils.translateDesignHeightToCode(30)
          }}
        >
          <Text
            style={{
              color: "#fff",
              fontSize: SizeUtils.translateFontSizeToCode(24)
            }}
          >
            {"立即报名"}
          </Text>
        </View>
      </TouchableOpacity>
    );
  }
}

import NewsConstants from "../../common/NewsConstants";
import NewsVideoView from "../news/NewsVideoView";
import CommonShowViewFullScreenAction from "../../actions/common/CommonShowViewFullScreenAction";
import { DateUtils } from "../../utils/Utils";
import WH_Constants from "../workhard/WH_Constants";

class Item extends BaseItem {
  constructor(props) {
    super(props);
    this.state={
      readers_num:this.props.data.readers_num,
      likers_num:this.props.data.likers_num 
    };
  }
   componentWillUpdate(nextProps, nextState) {
    if (nextProps.data.likers_num!==nextState.likers_num) {
      nextState.likers_num=nextProps.data.likers_num||0;
    }
    if (nextProps.data.readers_num!==nextState.readers_num) {
      nextState.readers_num=nextProps.data.readers_num||0;
    }
  }
  chageBrowse(read,like){
    this.setState({
      readers_num:read,
      likers_num:like
    });
  }
  render() {
    const { number, data, type } = this.props;
    if (number === 0 && type === "news") {
      return (
        <TouchableOpacity
          onPress={this._onPressItem.bind(this)}
          style={{
            flex: 1,
            paddingTop: SizeUtils.translateDesignHeightToCode(20),
            paddingBottom: SizeUtils.translateDesignHeightToCode(10),
            paddingLeft: SizeUtils.translateDesignWidthToCode(20),
            overflow:'hidden',
            borderTopWidth: SizeUtils.translateDesignNumToCode(3),
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee",
            paddingRight: SizeUtils.translateDesignWidthToCode(20)
          }}
        >
          <View
            style={{
              flex: 1,
              flexDirection: "column",
              overflow:'hidden',
              paddingTop: SizeUtils.translateDesignHeightToCode(0),
              paddingBottom: SizeUtils.translateDesignHeightToCode(10)
            }}
          >
            <Text
              numberOfLines={1}
              style={[
                CommonStyles.primaryText,
                {
                  marginTop: SizeUtils.translateDesignHeightToCode(10),
                  marginBottom: SizeUtils.translateDesignHeightToCode(15),
                  fontWeight: "bold",
                  color: "#000",
                  fontSize: SizeUtils.translateFontSizeToCode(30)
                }
              ]}
            >
              {this.props.data.title}
            </Text>
            {this._renderShowImageO(this.props.data)}
            {this._newsBottomView()}
          </View>
        </TouchableOpacity>
      );
    }
    if (type === "workHard") {
      return (<View/>)
      return (
        <TouchableOpacity
          onPress={this._onPressItem.bind(this)}
          style={{
            flex: 1,
            flexDirection: "row",
            paddingTop: SizeUtils.translateDesignHeightToCode(10),
            paddingBottom: SizeUtils.translateDesignHeightToCode(10),
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee",
            paddingLeft: SizeUtils.translateDesignWidthToCode(0),
            paddingRight: SizeUtils.translateDesignWidthToCode(0)
          }}
        >
          <View
            style={{
              flex: 1,
              flexDirection: "column",
              justifyContent: "space-between",
              paddingLeft: SizeUtils.translateDesignWidthToCode(10),
              paddingRight: SizeUtils.translateDesignWidthToCode(10),
              paddingTop: SizeUtils.translateDesignHeightToCode(10),
              paddingBottom: SizeUtils.translateDesignHeightToCode(10)
            }}
          >
            <Text
              numberOfLines={1}
              style={[
                CommonStyles.primaryText,
                {
                  marginTop: SizeUtils.translateDesignHeightToCode(10),
                  marginBottom: SizeUtils.translateDesignHeightToCode(10),
                  fontWeight: "bold",
                  color: "#000",
                  fontSize: SizeUtils.translateFontSizeToCode(30)
                }
              ]}
            >
              <Text style={{ color: "#ff6600" }}>
                {"【" +
                  WH_Constants.getTypeDataBySubTag(this.props.data.sub_tag) +
                  "】"}
              </Text>
              {this.props.data.title}
            </Text>
            {this._workHardBottomView()}
          </View>
        </TouchableOpacity>
      );
    }
    if (type === "zhibo") {
      return (
        <TouchableOpacity
          onPress={this._onPressItem.bind(this)}
          style={{
            flex: 1,
            paddingTop: SizeUtils.translateDesignHeightToCode(20),
            paddingLeft: SizeUtils.translateDesignWidthToCode(0),
            borderTopWidth: SizeUtils.translateDesignNumToCode(3),
            borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
            borderColor: "#eeeeee"
          }}
        >
          <View>
            <Text
              numberOfLines={1}
              style={[
                CommonStyles.primaryText,
                {
                  paddingLeft: SizeUtils.translateDesignWidthToCode(20),
                  marginTop: SizeUtils.translateDesignHeightToCode(10),
                  marginBottom: SizeUtils.translateDesignHeightToCode(15),
                  fontWeight: "bold",
                  color: "#000",
                  fontSize: SizeUtils.translateFontSizeToCode(30)
                }
              ]}
            >
              {this.props.data.title}
            </Text>
            <View>
              {this._renderShowOneImage(this.props.data)}
              {data.image_url ||
              (data.image_urls &&
                data.image_urls &&
                data.image_urls.length > 0) ? (
                <View
                  style={{
                    position: "absolute",
                    top: SizeUtils.translateDesignHeightToCode(450 - 100) / 2,
                    height: SizeUtils.translateDesignHeightToCode(100),
                    width: SizeUtils.translateDesignHeightToCode(100),
                    borderRadius: SizeUtils.translateDesignHeightToCode(100),
                    justifyContent: "center",
                    alignItems: "center",
                    left: SizeUtils.translateDesignWidthToCode(750 - 100) / 2,
                    backgroundColor: "rgba(0,0,0, 0.7)"
                  }}
                >
                  <Image
                    source={require("../../../resource/images/home/live_iocn.png")}
                  />
                </View>
              ) : null}
            </View>
          </View>
        </TouchableOpacity>
      );
    }
    return (
      <TouchableOpacity
        onPress={this._onPressItem.bind(this)}
        style={{
          flex: 1,
          flexDirection: "row",
          paddingTop: SizeUtils.translateDesignHeightToCode(25),
          paddingBottom: SizeUtils.translateDesignHeightToCode(20),
          borderBottomWidth: SizeUtils.translateDesignNumToCode(3),
          borderColor: "#eeeeee",
          paddingLeft: SizeUtils.translateDesignWidthToCode(20),
          paddingRight: SizeUtils.translateDesignWidthToCode(20)
        }}
      >
        {this._renderShowImage(this.props.data)}
        <View
          style={{
            flex: 1,
            flexDirection: "column",
            justifyContent: "space-between",
            paddingLeft: SizeUtils.translateDesignWidthToCode(20),
            paddingTop: SizeUtils.translateDesignHeightToCode(10),
            paddingBottom: SizeUtils.translateDesignHeightToCode(0)
          }}
        >
          <Text
            numberOfLines={2}
            style={[
              CommonStyles.primaryText,
              {
                color: "#000",
                marginBottom: SizeUtils.translateDesignHeightToCode(10),
                fontWeight: "bold",
                fontSize: SizeUtils.translateFontSizeToCode(30)
              }
            ]}
          >
            {this.props.data.title}
          </Text>
          {type === "news"
            ? this._newsBottomView()
            : this._renderDate(this.props.data, type)}
        </View>
      </TouchableOpacity>
    );
  }
  _renderDate(data, type) {
    if (type === "vipsercard_content") {
      return (
        <View
          style={{
            flexDirection: "row",
            paddingTop: SizeUtils.translateDesignHeightToCode(13)
          }}
        >
          <Text
            style={{
              fontSize: SizeUtils.translateFontSizeToCode(26),
              color: "#888888"
            }}
            numberOfLines={1}
          >
            {"开始时间：" + this._getTimeStr(data.posted_at)}
          </Text>
        </View>
      );
    }
    return <View />;
  }

  _getTimeStr(time) {
    var timeStr = DateUtils.formatHeartDate(time);
    return timeStr;
  }
  _workHardBottomView = () => (
    <View
      style={{
        flexDirection: "row",
        paddingLeft: SizeUtils.translateDesignWidthToCode(18),
        paddingRight: SizeUtils.translateDesignWidthToCode(25),
        paddingTop: SizeUtils.translateDesignHeightToCode(10),
        alignItems: "center"
      }}
    >
      <Text
        numberOfLines={1}
        style={[
          CommonStyles.secondaryText,
          {
            flex: 1,
            marginRight: SizeUtils.translateDesignWidthToCode(60),
            fontSize: SizeUtils.translateFontSizeToCode(26)
          }
        ]}
      >
        {this.props.data.content}
      </Text>
      <View style={{ flexDirection: "row" }}>
        <Text
          style={[
            CommonStyles.secondaryText,
            { marginLeft: 5, fontSize: SizeUtils.translateFontSizeToCode(24) }
          ]}
        >
          {DateUtils.formatDiffFromServerTime(this.props.data.posted_at)}
        </Text>
      </View>
    </View>
  );
  _newsBottomView = () => (
    <View
      style={{
        flexDirection: "row",
        paddingTop: SizeUtils.translateDesignHeightToCode(20),
        alignItems: "center"
      }}
    >
      <Text
        style={[
          CommonStyles.secondaryText,
          {
            flex: 1,
            fontSize: SizeUtils.translateFontSizeToCode(24)
          }
        ]}
      >
        {this._getDateSource(this.props.data)}
      </Text>
      <View
        style={{
          flexDirection: "row",
          alignItems: "center",
          justifyContent: "center"
        }}
      >
        {/**<TImage
          source={require("../../../resource/images/home/zan.png")}
          style={{ width: 34, height: 34 }}
        />
        <Text
          style={[
            CommonStyles.secondaryText,
            { marginRight:Platform.OS === "android"?6:0,fontSize: SizeUtils.translateFontSizeToCode(24) }
          ]}
        >
          {" " + this.state.likers_num}
        </Text>
        <TImage
          source={require("../../../resource/images/home/kan.png")}
          style={{ marginLeft: 10, width: 34, height: 34 }}
        />
        <Text
          style={[
            CommonStyles.secondaryText,
            {fontSize: SizeUtils.translateFontSizeToCode(24) }
          ]}
        >
          {" " + this.state.readers_num}
        </Text>**/}
        <Text
          style={[
            CommonStyles.secondaryText,
            { marginLeft: 10, fontSize: SizeUtils.translateFontSizeToCode(24) }
          ]}
        >
          {DateUtils.formatActivity1(this.props.data.posted_at)}
        </Text>
      </View>
    </View>
  );
  _renderShowImageO(data) {
    if (
      data.image_url ||
      (data.image_urls && data.image_urls && data.image_urls.length > 0)
    ) {
      if (data.image_urls.length===1) {
        return (
        <View
          style={{ flexDirection: "row", justifyContent: "space-between" }}
        >
              {this._renderShowOneImage(data)}
        </View>
      );
      }
      return (
        <View
          style={{ flexDirection: "row", justifyContent: "space-between" }}
        >
              {this._renderShowThreeImage({ uri: data.image_urls[0]||'' })}
              {this._renderShowThreeImage({ uri: data.image_urls[1]||'' })}
              {this._renderShowThreeImage({ uri: data.image_urls[2]||'' })}
        </View>
      );
    }
  }
  _renderShowThreeImage(data) {
    return (
        <TImage
          source={data}
          style={{ width: (750 - 50) / 3, height: 150 }}
          resizeMode={"cover"}
          isMini={true}
        />
      );
  }
  _renderShowOneImage(data) {
    if (
      data.image_url ||
      (data.image_urls && data.image_urls && data.image_urls.length > 0)
    ) {
      return (
        <TImage
          source={this._getImageSource(data)}
          style={{ width: 750, height: 450 }}
          resizeMode={"cover"}
          miniSize={'mini500'}
          isMini={true}
        />
      );
    }
  }
  _renderShowImage(data) {
    if (
      data.image_url ||
      (data.image_urls && data.image_urls && data.image_urls.length > 0)
    ) {
      return (
        <TImage
          source={this._getImageSource(data)}
          style={{ width: (750 - 50) / 3, height: 150 }}
          resizeMode={"cover"}
          miniSize={'mini500'}
          isMini={true}
        />
      );
    }
  }

  _getImageSource(data) {
    if (data.image_url) {
      return { uri: data.image_url };
    } else if (
      data.image_urls &&
      data.image_urls &&
      data.image_urls.length > 0
    ) {
      return { uri: data.image_urls[0] };
    } else {
      return { uri: "" };
    }
  }

  _getBottomText() {
    if (this.props.type == "workHard") {
      return (
        this.state.likers_num +
        " 赞 · " +
        this.props.data.comments_num +
        " 评论 " +
        this.state.readers_num +
        " 阅读 " +
        DateUtils.formatDiffFromServerTime(this.props.data.posted_at)
      );
    } else if (this.props.type == "news") {
      return (
        this._getDateSource(this.props.data) +
        " " +
        DateUtils.formatDiffFromServerTime(this.props.data.posted_at) +
        " 浏览:" +
        this.state.readers_num
      );
    }
  }

  _getDateSource(data) {
    if (data.source) {
      return data.source;
    }
    return "";
  }

  _onPressItem() {
    if (this.props.type == "news") {
      if (this.props.data.tag == NewsConstants.type_shipin) {
        new CommonShowViewFullScreenAction().call(this, {
          component: NewsVideoView,
          data: this.props.data
        });
      } else {
        this.gotoPage(Config.pages.news_content, {...this.props.data,chageBrowse:this.chageBrowse.bind(this)});
      }
    } else if (this.props.type == "workHard") {
      if (
        this.props.data.content&&(this.props.data.content.indexOf("https://mp.weixin.qq.com") === 0 ||
        this.props.data.content.indexOf("http://mp.weixin.qq.com") === 0)
      ) {
        this.gotoPage(Config.pages.chuangxin_web, {
          url: this.props.data.content,
          data: this.props.data
        });
      } else {
        this.gotoPage(Config.pages.wh_content, {...this.props.data,chageBrowse:this.chageBrowse.bind(this)});
      }
    } else if (this.props.type == "vipsercard_content") {
      this.gotoPage(Config.pages.vipactivitycontentpage, {...this.props.data,chageBrowse:this.chageBrowse.bind(this)});
    } else if (this.props.type == "zhibo") {
      this.gotoPage(Config.pages.post_common_web, {
        url: this.props.data.live_url,
        data: this.props.data
      });
    }
  }
}
// {type:"news", headerTitle:"最新新闻", hasMoreBtn:false, page_size:4,},
// {type:"workHard", headerTitle:"创新创效", hasMoreBtn:true, page_size:4,},
// {type:"activity", headerTitle:"文体活动", hasMoreBtn:true, page_size:4,},
// {type:"heart_eap", headerTitle:"EAP活动", hasMoreBtn:true, page_size:4,},
// {type:"heart_love", headerTitle:"爱情事", hasMoreBtn:true, page_size:4,},
